package com.handler;

import com.actor.ClusterServerMasterActor;
import com.handler.manager.BasicPacketHandler;
import com.message.Message.UserInfo;
import com.message.TransformationMessages;
import com.message.TransformationMessages.WorldPacket;

public class WorldOneHandler extends BasicPacketHandler {

	public WorldOneHandler() {
		super((short)1);
	}

	@Override
	public TransformationMessages.WorldPacket handle(WorldPacket packet) throws Exception {
		UserInfo info = UserInfo.parseFrom(packet.getBytes());
		UserInfo.Builder res = UserInfo.newBuilder();
		res.setId(1001);
		res.setName("server2 cmd 1 proceer");
		System.out.println("server2 cmd 1 proceer***"+info.getName());
		TransformationMessages.WorldPacket resPacket = new TransformationMessages.WorldPacket((short)2001,res.build().toByteArray());
		
		TransformationMessages.GameServerPacket sendToGameServer = new TransformationMessages.GameServerPacket((short)1001, res.build().toByteArray(), 2);
		ClusterServerMasterActor.getInstance().sendToGameServer(sendToGameServer);
		return resPacket;
	}

}
